package com.ouyeel.wlxer.widget;

import android.content.Context;
import android.widget.Toast;


/**
 * Created by rankaifeng on 2017/9/27.
 */

public class MyToast {
    private Toast mToast;
    private static final int DURATION = Toast.LENGTH_LONG;

    private MyToast(Context context, CharSequence text) {
//        View v = LayoutInflater.from(context).inflate(R.layout.my_toast, null);
//        TextView textView = (TextView) v.findViewById(R.id.tv_tost);
//        textView.setText(text);
        mToast = Toast.makeText(context, text, DURATION);
//        mToast.setView(v);
    }

    public static MyToast makeText(Context context, CharSequence text) {
        return new MyToast(context, text);
    }

    public void show() {
        if (mToast != null) {
            mToast.show();
        }
    }

    public void setGravity(int gravity, int xOffset, int yOffset) {
        if (mToast != null) {
            mToast.setGravity(gravity, xOffset, yOffset);
        }
    }
}
